package com.bj58.ecdata.mailreport.service.impl;

import java.util.List;

import com.bj58.ecdata.mailreport.db.CommonDao;
import com.bj58.ecdata.mailreport.db.DBConfig;
import com.bj58.ecdata.mailreport.model.IEMain;
import com.bj58.ecdata.mailreport.model.Paginate;
import com.bj58.ecdata.mailreport.service.AbstractBaseService;

public class IEMainService  extends AbstractBaseService<IEMain> {
	private CommonDao comDao = new CommonDao();
	
	public Paginate<IEMain> getPagListByCon(int pageIndex, int pageSize,
			String where) throws Exception {
		return getPaginate( where, null, pageIndex, pageSize, " creatTime desc");
	}

	public IEMain getById(int id) throws Exception {
		String sql = "select * from ie_main where id = " + id;
		return comDao.getAllColsByVo(sql, IEMain.class, DBConfig.db_manage.getIntType()).get(0);
	}

	public boolean updateVo(IEMain vo) throws Exception {
		int res =  comDao.updateByVo("ie_main", "id=" + vo.getId(), IEMain.class, vo, DBConfig.db_manage.getIntType());
		return res==0?false:true;
	}

	public List<IEMain> getByCondition(String condition) throws Exception {
		String sql = "select * from ie_main where " + condition ;
		return comDao.getAllColsByVo(sql, IEMain.class, DBConfig.db_manage.getIntType());
	}
	
	
}
